package com.chixing.day07.ProtoType;

public class Job {
    public int jobId;
    public Company company; // 所属公司 （id,name,....）关联对象
    public String jobName;
    public float jobMinSalary;
    public float jobMaxSalary;
    public String jobDegree;
    public String jobCity;


    public Job() {
    }

    public Job(int jobId, Company company, String jobName, float jobMinSalary, float jobMaxSalary, String jobDegree, String jobCity) {
        this.jobId = jobId;
        this.company = company;
        this.jobName = jobName;
        this.jobMinSalary = jobMinSalary;
        this.jobMaxSalary = jobMaxSalary;
        this.jobDegree = jobDegree;
        this.jobCity = jobCity;
    }

    public int getJobId() {
        return jobId;
    }

    public void setJobId(int jobId) {
        this.jobId = jobId;
    }

    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }

    public String getJobName() {
        return jobName;
    }

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    public float getJobMinSalary() {
        return jobMinSalary;
    }

    public void setJobMinSalary(float jobMinSalary) {
        this.jobMinSalary = jobMinSalary;
    }

    public float getJobMaxSalary() {
        return jobMaxSalary;
    }

    public void setJobMaxSalary(float jobMaxSalary) {
        this.jobMaxSalary = jobMaxSalary;
    }

    public String getJobDegree() {
        return jobDegree;
    }

    public void setJobDegree(String jobDegree) {
        this.jobDegree = jobDegree;
    }

    public String getJobCity() {
        return jobCity;
    }

    public void setJobCity(String jobCity) {
        this.jobCity = jobCity;
    }

    @Override
    public String toString() {
        return "Job{" +
                "jobId=" + jobId +
                ", company=" + company +
                ", jobName='" + jobName + '\'' +
                ", jobMinSalary=" + jobMinSalary +
                ", jobMaxSalary=" + jobMaxSalary +
                ", jobDegree='" + jobDegree + '\'' +
                ", jobCity='" + jobCity + '\'' +
                '}';
    }

    @Override
    protected Job clone() throws CloneNotSupportedException {
        Job jobClone = new Job();
        jobClone.jobId = this.jobId;
        jobClone.jobName = this.jobName;
        jobClone.jobMinSalary = this.jobMinSalary;
        jobClone.jobMaxSalary = this.jobMaxSalary;
        jobClone.jobDegree = this.jobDegree;
        jobClone.jobCity = this.jobCity;
//        jobClone.company = this.company;

        //深克隆
        // jobClone.company = (Company) this.company.clone();
        jobClone.company = this.company.clone(); //关联克隆

        return jobClone;
    }
}
